package com.example.common.exception;


import com.example.model.vo.common.ResultCodeEnum;
import lombok.Data;

@Data
public class GuiguException extends RuntimeException{

    private Integer code;
    private String message;
    private ResultCodeEnum resultCodeEnum;


    public GuiguException(ResultCodeEnum resultCodeEnum) {
        this.resultCodeEnum = resultCodeEnum;
        this.code = resultCodeEnum.getCode();
        this.message = resultCodeEnum.getMessage();
    }


    /**
     * 通过状态码和错误消息创建异常对象
     * @param message
     * @param code
     */
    public GuiguException(Integer code,String message) {
        super(message);
        this.code = code;
    }
}
